if (location.href.match(/\.mp4$/i)) {
	var box = document.createElement("div");
	box.style.backgroundColor = "#000000";
	box.style.color = "#FFFFFF";
	box.style.width = "100%";
	box.style.height = "100%";
	box.style.position = "absolute";
	box.style.top = "0";
	box.style.left = "0";
	box.style.textAlign = "center";
	box.style.fontSize = "12px";
	box.style.fontFamily = "'Lucida Grande', Arial, Helvetica, sans-serif";
	box.style.zIndex = "10000";
	document.body.appendChild(box);
	
	var logo = document.createElement("div");
	logo.style.paddingTop = "50px";
	logo.align = 'center';
	box.appendChild(logo);
	logo.innerHTML = "<img src='http://www.cuevana.tv/img/logo.png' />";
	
	var box2 = document.createElement("div");
	box2.style.paddingTop = "50px";
	box.appendChild(box2);
	if (document.getElementById("downloadLinkTarget")) {
		getLink();
	} else {
		var but = document.getElementById("basicLink");
	
		document.body.style.overflow = "hidden";
		if (but) {
			box2.appendChild(but);
			but.innerHTML = "Click aquí para cargar el video";
			but.className = '';
			but.style.background = "#333";
			but.style.fontWeight = "bold";
			but.style.padding = "3px 7px";
			but.style.color = "#FFFFFF";
			but.style.textDecoration = "none";
			
			if (but.addEventListener) {
				but.addEventListener("click", clickBut, false);
			} else {
				but.attachEvent("onlick", clickBut);
			}
		} else {
			var pag = document.body.innerHTML;
			if (pag.match(/this file is no longer available/i)) {
				box2.innerHTML = "El archivo ha sido eliminado de Filefactory.";
			}
		}
	}
}

// Funciones
function clickBut(e) {
	but.innerHTML = "Cargando...";
	if (but.removeEventListener) {
		but.removeEventListener("click", clickBut,false);
	} else {
		but.detachEvent("onlick", clickBut);
	}
	setTimeout("getCaptcha()",200);
}
function getCaptcha() {
	if (document.getElementById("recaptcha_area")) {
		var form = document.getElementById("ffRecaptcha");
		var ra = document.getElementById("recaptcha_area");
		ra.style.margin = "0 auto 15px";
		but.innerHTML = "Enviar captcha";
		but.style.marginTop = "15px";
		form.appendChild(but);
		box2.appendChild(form);
		return;
	}
	setTimeout("getCaptcha()",200);
}
function getLink() {
	if (document.getElementById("basicTimer")) {
		var d = parseInt(document.getElementById("basicTimer").childNodes[1].innerHTML);
		if (d>100) {
			box2.innerHTML = "Has superado el límite de descarga en Filefactory. Puedes volver a descargar en "+d+" segundos o puedes <a href='http://www.filefactory.com/premium/' target='_blank'>comprar una cuenta premium en Filefactory</a> para descargar sin límites.";
			setTimeout("getLink()",1000)
			return;
		} else if (d>20) {
			box2.innerHTML = "Por favor espera "+(d-20)+" segundos.";
			setTimeout("getLink()",1000)
			return;
		}
	}
	var a = document.getElementById("downloadLinkTarget");
	var ff = location.href.match(/dlf\/f\/([a-z0-9]+)\//i);
	window.location = 'http://www.cuevana.tv/player/geturl.php?megaurl='+a.href+'&count=20&factory='+ff[1];
}